﻿@using AVCare.LMS.Util;
@model List<AVCare.LMS.Models.Function>
<script type="text/javascript">
    jQuery(function ($) {
        var isShow = false;
        $("#mainMenu a[href='javascript:void(0);']").toggle(
            function () {
                var container = $("#submenu ul");
                $("#submenu").animate({ "marginTop": "0" }, 800);
                container.css({ "position": "relative", "left": $(this).offset().left / 2 });
            },
            function () {
                $("#submenu").animate({ "marginTop": "-25" }, 800);
            }
        );
        $("#mainMenu a[href='javascript:void(0);']").bind("mouseover", function () {
            var id = this.id;
            var menu = this;
            $.ajax({
                type: "post",
                url: "/Menu/SubMenu",
                data: { id: id},
                success: function (msg) {
                    var container = $("#submenu ul");
                    container.empty();
                    for (var i = 0; i < msg.length; i++) {
                        var item = $("<li><a id=\"" + msg[i].ID + "\" href=\"" + msg[i].URL + "\">" + msg[i].Name + "</a></li>");
                        container.append(item);
                    }
                    container.css({ "width": msg.length * 110 });
                },
                error: function () {
                    alert("error");
                }
            });
        });
    });
</script>
<div id="menuBox">
    <div id="menu">
        <div id="logo">
            <img src="@Url.Content("~/Content/img/logo.png")" alt="logo" style="position:absolute; bottom:0px; left:30%;" />
        </div>
        <span style="position: absolute; left: 170px; top: 5px; font-size: 1.6em;">@LanguageHelper.GetString("message.softname")
        </span>
        <div id="menuContainer">
            <ul id="mainMenu">
                @foreach (var item in Model)
                {
                    if (item.IsGroup == "1")
                    {
                    <li><a id="@item.ID" href="javascript:void(0);">@LanguageHelper.GetString(item.Name)</a></li>     
                    }
                    else
                    { 
                    <li><a id="@item.ID" href="@item.URL">@LanguageHelper.GetString(item.Name)</a></li>
                    }

                }
            </ul>
        </div>
    </div>
    <div id="submenu">
        <ul>
        </ul>
    </div>
</div>
